package com.zl.model;

import com.zl.controller.annotation.First;
import com.zl.controller.annotation.Second;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @author ZLL
 * @date create in 2018/04/26
 */
@Data
public class MyValidateUser implements Serializable {
    @NotNull(message = "{user.id.null}", groups = {First.class, Second.class})
    private Long id;

    @NotEmpty(message = "{user.name.null}")
    @Length(min = 5, max = 20, message = "{user.name.length.illegal}")
    @Pattern(regexp = "[a-zA-Z]{5,20}", message = "{user.name.illegal}")
    private String name;

    @NotNull(message = "{user.password.null}", groups = First.class)
    private String password;
}
